import { type DefaultTheme, defineConfig } from 'vitepress'
import setSidebar from './setSidebar'

const nav: DefaultTheme.NavItem[] = [
  {
    text: '流程制度',
    items: setSidebar('workflow'),
  },
  {
    text: '工作规范',
    items: setSidebar('standard'),
  },
  {
    text: '学习分享',
    items: setSidebar('study'),
  },
  {
    text: '工程设施',
    items: setSidebar('library'),
  },
]

const sidebar: DefaultTheme.Sidebar = {
  '/workflow/': setSidebar('workflow'),
  '/standard/': setSidebar('standard'),
  '/study/': setSidebar('study'),
  '/library/': setSidebar('library'),
}

export default defineConfig({
  title: '前端-文档', //标题
  lastUpdated: true, //开启上次更新时间
  head: [
    [
      'link',
      {
        rel: 'shortcut icon',
        href: '/favicon.ico',
      },
    ],
  ],
  themeConfig: {
    // logo: '/photo.png',
    siteTitle: '前端-文档',
    socialLinks: [
      {
        icon: 'github',
        link: 'http://tm-codebase.tianmcloud.com/web/web_doc',
      },
    ],
    nav,
    sidebar,
    // algolia: {
    //   appId: 'KXO9H4E3E6',
    //   apiKey: 'd03b0c8b44f999ca1d5b735c531d3770',
    //   indexName: 'doc-wmkj',
    // },
  },
})
